package com.runchamp;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;

public class PersonalZone extends BaseActivity {
    private PersonalZoneCollectionAdapter adapter;
    private ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_personal_zone);
        position = 0;
        getLayoutInflater().inflate(R.layout.activity_personal_zone, frameLayout);

        /**
         * Setting title and itemChecked
         */
        mDrawerList.setItemChecked(position, true);
        setTitle(listArray.get(position));
        adapter = new PersonalZoneCollectionAdapter(getSupportFragmentManager());
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(adapter);

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
            Log.d("back pressed", "back");
            finish();

            return true;
        } else {

            return super.onKeyDown(keyCode, event);
        }
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        position = 1;
        finish();
        return true;
    }
}